package api

object TupleDemo {
  def main(args: Array[String]): Unit = {
    var longgest = longestWord("The quick brown fox".split(" "))
    println(longgest)
  }

  def longestWord(words: Array[String]): (Int, String) = {
    var word = words(0)
    var idx = 0;
    for (i <- 1 until word.length) {
      if (words(i).length > word.length)
        word = words(i)
      idx = i
    }
    (idx, word)
  }
}
